package gdocsclassify.actions;

import gdocsclassify.GDOCSclassify;
import gdocsclassify.ui.GDOCSclassifyUI;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import com.google.gdata.util.AuthenticationException;

public class LoginAction extends AbstractAction {

	private GDOCSclassify client;
	public LoginAction(GDOCSclassify client, GDOCSclassifyUI ui)
	{
		super("Login");
		this.client = client;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		GDOCSclassifyUI ui = GDOCSclassifyUI.get_instance();
		String username = ui.getUsername();
		String password = ui.getPassword();
		try {
			this.client.login(username,password);
		} catch (AuthenticationException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		ui.loginSuccessful();
	}
}